﻿using FitNesseRunner.Model;

namespace FitNesseRunner
{
	public class DecisionTableHandler : ITableHandler
	{
		private readonly IReporter _reporter;
		private readonly IReflectionProvider _reflectionProvider;

		public DecisionTableHandler(IReporter reporter, IReflectionProvider reflectionProvider)
		{
			_reporter = reporter;
			_reflectionProvider = reflectionProvider;
		}

		public void Handle(ITable table)
		{
			var decisionTable = new DecisionTable(table.Cells, _reporter, _reflectionProvider);
			decisionTable.ExecuteAll();
		}

		public bool CanHandle(ITable table)
		{
			return true;
		}
	}
}
